/**
 * Author(s): xuming.Wong <xuming.Wong@gmail.com>
 */

#include <QtGui/QLayout>
#include <QtGui/QMouseEvent>
#include <QtGui/QLabel>
#include <QtGui/QLineEdit>
#include <QtGui/QCheckBox>

#include "SphereColliderControl.h"

namespace PQBuilder
{
	SphereColliderControl::SphereColliderControl(QWidget *parent,PQEngine::SphereColliderComponent* component)
	{
		_sphereCollider=component;
		if(_sphereCollider!=0){
			Ogre::Vector3 pos=_sphereCollider->getPosition();
			float radius=_sphereCollider->getRadius();

			QGridLayout* grid=new QGridLayout(this);


			QLabel* labelCenter=new QLabel("Center",this);

			QLabel* labelCenterX=new QLabel("X",this);
			QLineEdit* editCenterX=new QLineEdit(this);
			labelCenterX->setAlignment(Qt::AlignHCenter);
			editCenterX->setText(QString::fromStdString(Ogre::StringConverter::toString(pos.x)));

			QLabel* labelCenterY=new QLabel("Y",this);
			QLineEdit* editCenterY=new QLineEdit(this);
			labelCenterY->setAlignment(Qt::AlignHCenter);
			editCenterY->setText(QString::fromStdString(Ogre::StringConverter::toString(pos.y)));

			QLabel* labelCenterZ=new QLabel("Z",this);
			QLineEdit* editCenterZ=new QLineEdit(this);
			labelCenterZ->setAlignment(Qt::AlignHCenter);
			editCenterZ->setText(QString::fromStdString(Ogre::StringConverter::toString(pos.z)));
			
			QLabel* labelRadius=new QLabel("Radius",this);
			QLineEdit* editRadius=new QLineEdit(this);
			editRadius->setText(QString::fromStdString(Ogre::StringConverter::toString(radius)));

			grid->addWidget(labelCenter,0,0,1,2);

			grid->addWidget(labelCenterX,1,0);
			grid->addWidget(editCenterX,1,1);

			grid->addWidget(labelCenterY,2,0);
			grid->addWidget(editCenterY,2,1);

			grid->addWidget(labelCenterZ,3,0);
			grid->addWidget(editCenterZ,3,1);

			grid->addWidget(labelRadius,4,0);
			grid->addWidget(editRadius,4,1);

			this->setLayout(grid);
			
		}
		
		
	}

	SphereColliderControl::~SphereColliderControl()
	{
	}
	
}
